﻿using System.Linq;

namespace Unijovem.UI.Models
{
    public class YouTubeModel
    {
        public int Width { get; set; }
        public int Height { get; set; }

        private string url;
        public string Url
        {
            set
            {
                url = value.ToUpper().Contains("EMBED")
                          ? value
                          : value.Split(new[] { '?', '&' }).First(m => m.StartsWith("v=")).Replace("v=",
                                                                                                                  "http://www.youtube.com/embed/");
            }
            get { return url; }
        }
    }
}